﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace G.Service.Data
{
    public class APPData : BaseData
    {
        #region Application
        public void AddApplication(Application app)
        {
            this.Entities.AddToApplications(app);
        }

        public Application GetApplicationById(int id)
        {
            return this.Entities.Applications.FirstOrDefault(c => c.ID == id);
        }

        public Application GetApplicationByAppKey(string appkey)
        {
            return this.Entities.Applications.FirstOrDefault(c => c.AppKey == appkey);
        }
        #endregion

        #region APPEvent
        public void AddAppEvent(APPEvent e)
        {
            this.Entities.AddToAPPEvents(e);
        }

        public APPEvent GetAPPEventById(int id)
        {
            return this.Entities.APPEvents.FirstOrDefault(c => c.Id == id);
        }
        #endregion

        #region Event
        public void AddEvent(Event e)
        {

            this.Entities.AddObject("Events", e);
        }
        #endregion

    }
}
